package com.framework.core.exception;

public abstract class BaseException extends RuntimeException {

	private static final long serialVersionUID = -7126114767624436789L;

	/**
	 * 异常编号 项目编码（2位）+模块编号(1级2位+2级2位)+类编号+方法编号+异常编号
	 */
	private String err_num = "";

	private String err_msg = "";

	public BaseException(Exception ex) {
		this(ex.getMessage());
		this.setStackTrace(ex.getStackTrace());
	}

	public BaseException(String msg) {
		super(msg);
		if (msg != null) {
			this.err_msg = msg;
		}

	}

	public BaseException(String err_num, String msg, Throwable cause) {
		super(msg, cause);

		if (err_num != null) {
			this.err_num = err_num;
		}
		if (msg != null) {
			this.err_msg = msg;
		}
	}

	public String getMessage() {
		if ("".equals(this.err_num)) {
			return this.err_msg;
		}
		return this.err_num + ":" + super.getMessage();
	}
}
